home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 60.zip
/
BS1 part 60
/
Kick Pascal v2.10 d2.adf
/
SYSPROG
/
GadgetDemo.p
< prev
next >
Wrap
Text File
|
1990-11-01
|
9KB
|
201 lines
Program GadgetDemo;
{$incl 'intuition.lib' }
Type
BorDatTyp = Array[1..10] of integer; { Typ für Borderdata }
ImgDatTyp = Array[1..12] of Long; { Typ für Imagedata }
Var
Win: ^Window;
Msg: ^IntuiMessage;
Gad1, Gad2, Gad3, Gad4, Gad5: Gadget;
Tex1, Tex2, Tex3, Tex4, Tex5: IntuiText;
Bor1, Bor2, Bor5: Border;
BDt1, BDt2, BDt5: BorDatTyp;
Img1, Img2, Img3, Img4: Image;
IDt1, IDt2, IDt3, IDt4: ^ImgDatTyp;
AktGad: ^Gadget;
Ende: Boolean;
Procedure Ausgabe(t: Str);
{ gibt den Text "t" im Window aus }
Var it: IntuiText;
Begin
it:=IntuiText(1,0,1,0,0,Nil,t,Nil);
PrintIText(Win^.RPort, ^it, 5, 12)
End;
Begin
OpenLib(IntBase, 'intuition.library', 0);
Win:=Open_Window(0, 0, 320, 120, 1, _CLOSEWINDOW+GADGETUP+GADGETDOWN,
WINDOWSIZING+WINDOWDRAG+WINDOWDEPTH+WINDOWCLOSE+ACTIVATE,
'GadgetDemo', Nil, 300, 100, 640, 256);
Gad1:=Gadget(Nil, { erste Gadget-Struktur: }
10,25, { Position }
80,12, { Größe }
GADGHCOMP, { Gadget wird invertiert }
TOGGLESELECT+GADGIMMEDIATE, { Activation Flags }
BOOLGADGET, { Typ }
^Bor1, { Zeiger auf Borderstruktur }
Nil, { kein Select-Border }
^Tex1, { Zeiger auf Text }
0, Nil, 1, 0); { Nummer 1 }
Tex1:=IntuiText(1, 0, 0, 16, 3, Nil, 'Toggle', Nil);
Bor1:=Border(0, 0, 3, 0, 0, 5, ^BDt1, Nil);
BDt1:=BorDatTyp(-3,-2, 83,-2, 83,14, -3,14, -3,-2);
Gad2:=Gadget(Nil, { zweite Gadget-Struktur: }
10,48, { Position }
80,12, { Größe }
GADGHBOX, { Gadget wird umrandet }
RELVERIFY, { Activation Flags }
BOOLGADGET, { Typ }
^Bor2, { Zeiger auf Borderstruktur }
Nil, { kein Select-Border }
^Tex2, { Zeiger auf Text }
0, Nil, 2, 0); { Nummer 2 }
Tex2:=IntuiText(1, 0, 0, 8, 3, Nil, 'Nummer 2', Nil);
Bor2:=Border(0, 0, 1, 0, 0, 5, ^BDt2, Nil);
BDt2:=BorDatTyp(-3,-3, 83,-3, 83,14, -3,14, -3,-3);
Gad3:=Gadget(Nil, { dritte Gadget-Struktur: }
200,25, { Position }
32,12, { Größe }
GADGHIMAGE+GADGIMAGE, { Gadget hat Bild }
RELVERIFY+TOGGLESELECT, { Activation Flags }
BOOLGADGET, { Typ }
^Img1, { Zeiger auf Imagestruktur }
^Img2, { Select-Image }
^Tex3, { Zeiger auf Text }
0, Nil, 3, 0); { Nummer 3 }
Tex3:=IntuiText(1, 0, 0, -100, 3, Nil, 'Mit Bild:', Nil);
IDt1:=Ptr(Alloc_Mem(SizeOf(ImgDatTyp),2));
IDt1^:=ImgDatTyp(%00000000000000000000000111000000,
%00000000000000000000111111111000,
%00000000000000000111111111111111,
%00000000000000000000001111100000,
%00000000000000000000001111100000,
%11111110000000000000001111100000,
%11111111110000000000011111100000,
%00000011111000000001111111000000,
%00000001111111111111111100000000,
%00000000011111111111100000000000,
%00000000000000000000000000000000,
%00000000000000000000000000000000);
IDt2:=Ptr(Alloc_Mem(SizeOf(ImgDatTyp),2));
IDt2^:=ImgDatTyp(%00000000000000000000000000000000,
%00000000000000000000000000000000,
%00000000011111111111100000000000,
%00000001111111111111111100000000,
%00000011111000000001111111000000,
%11111111110000000000011111100000,
%11111110000000000000001111100000,
%00000000000000000000001111100000,
%00000000000000000111111111111111,
%00000000000000000000111111111000,
%00000000000000000000001111100000,
%00000000000000000000000111000000);
Img1:=Image(0,0,32,12,1,IDt1,1,3,Nil);
Img2:=Image(0,0,32,12,1,IDt2,1,3,Nil);
Gad4:=Gadget(Nil, { dritte Gadget-Struktur: }
-40,20, { Position }
32,12, { Größe }
GADGHIMAGE+GADGIMAGE+GRELRIGHT,{ relativ zu rechtem Rand }
RELVERIFY+TOGGLESELECT, { Activation Flags }
BOOLGADGET, { Typ }
^Img4, { Zeiger auf Image }
^Img3, { Select-Image }
^Tex4, { Zeiger auf Text }
0, Nil, 4, 0); { Nummer 4 }
Tex4:=IntuiText(3, 0, 0, -4, 3, Nil, ' *4* ', Nil);
IDt3:=Ptr(Alloc_Mem(SizeOf(ImgDatTyp),2));
IDt3^:=ImgDatTyp(%11100000000000000000000000000111,
%00111100000000000000000000111100,
%00000111000000000000000111100000,
%00000001111000000000011100000000,
%00000000001110000011110000000000,
%00000000000011111110000000000000,
%00000000000001111110000000000000,
%00000000000111000011110000000000,
%00000000111100000000011100000000,
%00000111100000000000000111100000,
%00111100000000000000000000111100,
%11100000000000000000000000000111);
Img3:=Image(0,0,32,12,0,IDt3,1,0,Nil);
IDt4:=Ptr(Alloc_Mem(SizeOf(ImgDatTyp),2));
IDt4^:=ImgDatTyp(%00000011111111111111111111000000,
%00001111100000000000000111110000,
%00111100000000000000000000111100,
%01110000000000000000000000001110,
%11100000000000000000000000000111,
%11100000000000000000000000000111,
%11100000000000000000000000000111,
%11100000000000000000000000000111,
%01110000000000000000000000001110,
%00111100000000000000000000111100,
%00001111100000000000000111110000,
%00000011111111111111111110000000);
Img4:=Image(0,0,32,12,0,IDt4,1,0,Nil);
Gad5:=Gadget(Nil, { erste Gadget-Struktur: }
250,80, { Position }
-272, -92, { Größe }
GADGHCOMP+GRELWIDTH+GRELHEIGHT,
RIGHTBORDER+BOTTOMBORDER+RELVERIFY,
BOOLGADGET, { Typ }
^Bor5, { Zeiger auf Borderstruktur }
Nil, { kein Select-Border }
^Tex5, { Zeiger auf Text }
0, Nil, 5, 0); { Nummer 5 }
Tex5:=IntuiText(1, 0, 0, 3, 3, Nil, 'Gadget#5', Nil);
Bor5:=Border(0, 0, 3, 0, 0, 5, ^BDt5, Nil);
BDt5:=BorDatTyp(-3,-2, 280,-2, 280,90, -3,90, -3,-2);
AddGadget(Win, ^Gad1, Nil);
AddGadget(Win, ^Gad2, Nil);
AddGadget(Win, ^Gad3, Nil);
AddGadget(Win, ^Gad4, Nil);
AddGadget(Win, ^Gad5, Nil);
RefreshGadgets(Win^.FirstGadget, Win, Nil);
Ende:=False;
Repeat
Msg:=Wait_Port(Win^.UserPort);
Msg:=Get_Msg(Win^.UserPort);
Case Msg^.Class Of
_CLOSEWINDOW: Ende:=True;
GADGETUP,GADGETDOWN:
Begin
AktGad:=Msg^.IAddress;
Case AktGad^.GadgetID Of
1: If (Gad1.Flags and SELECTED)<>0 Then
Ausgabe('Gadget 1 an. ')
Else
Ausgabe('Gadget 1 aus. ');
2: Ausgabe('Gadget 2 angewählt.');
3: If (Gad3.Flags and SELECTED)<>0 Then
Ausgabe('Pfeil nach unten ')
Else
Ausgabe('Pfeil nach oben ');
4: If (Gad4.Flags and SELECTED)=0 Then
Ausgabe('Eingekreist. ')
Else
Ausgabe('Durchgestrichen. ');
5: Ausgabe('Unten rechts. ');
Otherwise;
End { inneres CASE }
End;
Otherwise;
End; { of CASE }
Reply_Msg(Msg);
Until Ende;
Close_Window(Win);
CloseLib(IntBase);
Free_Mem(Long(IDt1),SizeOf(ImgDatTyp));
Free_Mem(Long(IDt2),SizeOf(ImgDatTyp));
Free_Mem(Long(IDt3),SizeOf(ImgDatTyp));
End.